<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a="http://richfaces.org/a4j"
	xmlns:birt="http://jsf4birt.components"
	template="/templates/template.xhtml">
    
<ui:define name="title">#{msg['menu.titulo.cargaExcel.comites']}</ui:define>
<ui:define name="body">

    <h:form id="committeesInputDataLoad" styleClass="edit">
    
    	<h:outputText value="#{committeesInputDataLoadController.loadDefaultValues()}"/>

        <rich:simpleTogglePanel label="#{msg['committeesInputDataLoad.title']}" switchType="ajax">
        	
        	<h:panelGrid columns="6" >
				<h:outputText value="#{msg['general.selectFile']}" />
				
				<rich:spacer width="20"/>
				
	            <rich:fileUpload fileUploadListener="#{committeesInputDataLoadController.listener}"
	                maxFilesQuantity="1"
	                id="fileUploadId" 
	                immediateUpload="true"
	                acceptedTypes="#{msg['general.validate.fileTypes']}" allowFlash="false"
	                addControlLabel="#{msg['general.search']}"
	                clearControlLabel=""
	                doneLabel="#{msg['general.done']}"
	                listHeight="60" listWidth="450"
	                progressLabel="#{msg['general.progress']}"
	                stopControlLabel="#{msg['general.stop']}"
	                uploadControlLabel="#{msg['general.uploadFile']}"
	                cancelEntryControlLabel="#{msg['general.cancel']}"
	                clearAllControlLabel="#{msg['general.cleanAll']}"
	                >
	                <a:support event="onuploadcomplete" reRender="info,buttonsDataLoad" />
	            </rich:fileUpload>
	            
	            <rich:spacer width="20"/>
	            
	            <h:panelGroup id="info">
	                <rich:panel bodyClass="info">
	                    <h:outputText value="#{msg['general.noFileSelected']}"
	                        rendered="#{empty committeesInputDataLoadController.files}" />
	                    <h:outputText value="#{msg['general.fileSelected']}"
	                        rendered="#{not empty committeesInputDataLoadController.files}" />
	                </rich:panel>
	            </h:panelGroup>

				<rich:message for="fileUploadId" styleClass="messageError" />
				
			</h:panelGrid>
			
			<h:panelGrid columns="6" >
			
				<h:outputText value="#{msg['general.year']}" />
				
				<rich:spacer width="20"/>
				
				<h:inputText value="#{committeesInputDataLoadController.anio}" size="5"/>
				
				<rich:spacer width="20"/>
				
				<h:outputText value="#{msg['general.quarter']}" /> 
				
				<h:selectOneMenu id="cmbTrimestre"
					value="#{committeesInputDataLoadController.trimestre}"
					styleClass="cmbForm">
					<f:selectItem itemLabel="I" itemValue="1" />
					<f:selectItem itemLabel="II" itemValue="2" />
					<f:selectItem itemLabel="III" itemValue="3" />
					<f:selectItem itemLabel="IV" itemValue="4" />
				</h:selectOneMenu>
				
			</h:panelGrid>
			
	        <br/>
	        
	        <a:outputPanel id="messagesPanel"> 
	        	<div align="center">
					<a:outputPanel style="align:left" rendered="#{not empty committeesInputDataLoadController.messageError}">
				   		<h:graphicImage id="imgError" value="/images/error.gif" rendered="#{not empty committeesInputDataLoadController.messageError}" styleClass="errors" />
						<h:outputLabel value="#{committeesInputDataLoadController.messageError}" rendered="#{not empty committeesInputDataLoadController.messageError}" styleClass="errors"/>
						<rich:spacer height="20" rendered="#{not empty committeesInputDataLoadController.messageError}"/>
					</a:outputPanel>
					
					<a:outputPanel style="align:left" rendered="#{not empty committeesInputDataLoadController.messageInfo}">
				   		<h:graphicImage id="imgMessage" value="/images/msginfo.png" rendered="#{not empty committeesInputDataLoadController.messageInfo}" />
						<h:outputLabel value="#{committeesInputDataLoadController.messageInfo}" rendered="#{not empty committeesInputDataLoadController.messageInfo}"/>
						<rich:spacer height="20" rendered="#{not empty committeesInputDataLoadController.messageInfo}"/>
					</a:outputPanel>
				</div>
			</a:outputPanel>
			
			<rich:spacer height="20"/>
	        
	        <div align="center">
	        	<a:outputPanel id="buttonsDataLoad">
	        
	        		<!-- 
			        <a:commandButton action="#{committeesInputDataLoadController.loadData(true)}"
			        	onclick="Richfaces.showModalPanel('pnlModalProcess')"
						value="#{msg['general.validateFile']}" 
						disabled="#{not empty committeesInputDataLoadController.messageError}"
						oncomplete="Richfaces.hideModalPanel('pnlModalProcess')"
						rendered="#{not empty committeesInputDataLoadController.files}"
						reRender="messagesPanel,errorListPanel"/>
						
					<rich:spacer width="20"/> -->
						
					<a:commandButton action="#{committeesInputDataLoadController.loadData(false)}"
						onclick="if(!confirm('#{msg['general.importData.confirm']}')) return false; Richfaces.showModalPanel('pnlModalProcess');" 
						value="#{msg['general.importData']}" 
						disabled="#{not empty committeesInputDataLoadController.messageError}"
						oncomplete="Richfaces.hideModalPanel('pnlModalProcess')"
						rendered="#{not empty committeesInputDataLoadController.files}"
						reRender="messagesPanel,errorListPanel"/>
		
					<rich:spacer width="20"/>

					<h:commandButton action="/data/CommitteesInputDataLoad.xhtml"
						value="#{msg['general.cleanAll']}" 
						/>
				
				</a:outputPanel>
			</div>
        </rich:simpleTogglePanel>
        
        <rich:spacer height="20"/>
        
        <a:outputPanel id="errorListPanel">
			<rich:panel rendered="#{not empty committeesInputDataLoadController.generalDataLoadErrorBeanList}">
			
		    <div id="dataErrorList">
			    <rich:dataTable id="errorMessageList" width="90%" align="center"
			    			rows="#{msg['general.pagination.rowsPerSmallPage']}"
			                var="_generalDataLoadErrorBean"
			              value="#{committeesInputDataLoadController.generalDataLoadErrorBeanList}"
			           rendered="#{not empty committeesInputDataLoadController.generalDataLoadErrorBeanList}"
			           styleClass="labelBlackCenter,labelBlackLeft">
			           
			        <rich:column sortBy="#{_generalDataLoadErrorBean.rowError}">
			            <f:facet name="header">#{msg['general.row']}</f:facet>
			            <h:outputText value="#{_generalDataLoadErrorBean.rowError}"/>
			        </rich:column>
			        
			        <rich:column sortBy="#{_generalDataLoadErrorBean.errorDescription}">
			            <f:facet name="header">#{msg['general.error']}</f:facet>
			            <h:outputText value="#{_generalDataLoadErrorBean.errorDescription}"/>
			        </rich:column>
			        
			    </rich:dataTable>
			    
			    <rich:datascroller align="left" for="errorMessageList" renderIfSinglePage="false" styleClass="tableControl"
				    	maxPages="#{msg['general.pagination.maxGroupPages']}" rendered="#{not empty committeesInputDataLoadController.generalDataLoadErrorBeanList}" />

		    </div>
		    </rich:panel>
	    </a:outputPanel>
			
		<rich:modalPanel id="pnlModalProcess" autosized="true" minWidth="200">
	   		<center>
	      		<p>#{msg['general.validatingFile']}</p>
			</center>
	    </rich:modalPanel>


</h:form>

</ui:define>

</ui:composition>